<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var arr = [1, 2, 3, 1, 2]
    // console.log(new Set(arr), 8888);
    // console.log(Array.from(new Set(arr)), 9999);
		// var  newArr=Array.from(new Set(arr))
		/* 
		
		数组去重   3中
		+  双重 for循环
		+  new  Set
		+  reduce
		 */

		// var  all= arr.reduce((total,num)=>{
		// 	 return total+num
		//  },0)
		//  console.log(all,6666);
		var  all= arr.reduce((total,num)=>{
			  if(!total.includes(num)){
					total.push(num)
				}
				return total
		 },[])
		 console.log(all,6666);


  </script>
</body>

</html>
